// import { netMemberStep } from "./../service/TaskService";
export const NameSpace = "taskModel";

function createAction(action, payload) {
  return { type: `${NameSpace}/${action}`, payload };
}

export const Actions = {
  actionTaskData(params) {
    return createAction('TaskData', params)
  },
  actionSelectId(params) {
    return createAction('selectId', params)
  },
  actionTaskTab(params) {
    return createAction('taskTab', params)
  },
  actionTaskDetailTab(params) {
    return createAction('taskDetailTab', params)
  },
  actionCuiji(params) {
    return createAction('GetCuijiId', params)
  },
  actionLocationData(params) {
    return createAction('locationData', params)
  },
  // 考勤
  actionSelectBanci(params) {
    return createAction('SelectBanci', params)
  },
  actionAttendTab(params) {
    return createAction('AttendTabIndex', params)
  },
  actionSetDailyId(params) {
    return createAction('SetDailyId', params)
  },
  actionApplyTab(params){
    return createAction('ApplyTabIndex', params)
  },
  actionSetRecordId(params){
    return createAction('SetRecordId', params)
  },
  actionSelectProblem(params){
    return createAction('SelectProblem', params)
  },
  actionselectNews(params){
    return createAction('selectNews', params)
  },
};
export default {
  namespace: NameSpace,
  state: {
    taskId: null,
    cuijiId: null,
    caseId: null,
    taskTabIndex: 0,
    taskDetailTabIndex: 0,
    TaskData: null,
    locationData:null,
    expiredDays:0,
    // 考勤
    SelectBanci:null,
    AttendTabIndex: 0,
    dailyId: null,
    applyTabIndex:0,
    recordId:null,
    recordType:null,
    problemId:null,
    selectNews:null
  },
  reducers: {
    selectId(state, { payload }) {
      return {
        ...state,
        taskId: payload.taskId,
        caseId: payload.caseId,
        expiredDays:payload.expiredDays
      }
    },
    TaskData(state, { payload }) {
      return {
        ...state,
        TaskData: payload.TaskData,
      }
    },
    taskTab(state, { payload }) {
      return {
        ...state,
        taskTabIndex: payload.taskTabIndex,
      }
    },
    taskDetailTab(state, { payload }) {
      return {
        ...state,
        taskDetailTabIndex: payload.taskDetailTabIndex,
      }
    },
    GetCuijiId(state, { payload }) {
      return {
        ...state,
        cuijiId: payload.cuijiId,
      }
    },
    locationData(state, { payload }) {
      return {
        ...state,
        locationData: payload.locationData,
      }
    },
    // 考勤
    SelectBanci(state, { payload }) {
      return {
        ...state,
        SelectBanci: payload.Banci,
      }
    },
    AttendTabIndex(state, { payload }) {
      return {
        ...state,
        AttendTabIndex: payload.AttendTabIndex,
      }
    },
    SetDailyId(state, { payload }) {
      return {
        ...state,
        dailyId: payload.dailyId,
      }
    },
    ApplyTabIndex(state, { payload }) {
      return {
        ...state,
        applyTabIndex: payload.applyTabIndex,
      }
    },
    SetRecordId(state, { payload }) {
      return {
        ...state,
        recordId: payload.recordId,
        recordType: payload.recordType,
      }
    },
    SelectProblem(state, { payload }) {
      return {
        ...state,
        problemId: payload.problemId,
      }
    },
    selectNews(state, { payload }) {
      return {
        ...state,
        selectNews: payload.selectNews,
      }
    },
    
  },
  asyncTasks: {
    // asyncMemberInfo({ dispatch }, { payload }) {
    //   netMemberStep(payload)
    //     .then(function (data) {
    //       dispatch(actionMember(data));
    //     })
    //     .catch(function (error) {
    //       LogUtil.err(error);
    //     });
    // },

  }
};
